package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyPassKindBean;
import flc.ast.bean.MyWifiBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class PasswordFunctionAdapter extends StkProviderMultiAdapter<MyPassKindBean> {

    public PasswordFunctionAdapter() {
        addItemProvider(new StkSingleSpanProvider(30));
        addItemProvider(new PasswordFunctionProvider());
    }

    private class PasswordFunctionProvider extends BaseItemProvider<MyPassKindBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_password_function;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyPassKindBean bean) {
            baseViewHolder.setImageResource(R.id.ivPasswordFunctionItemImg, bean.getFunctionImg());
            baseViewHolder.setText(R.id.tvPasswordFunctionItemName, bean.getKind());
            if (bean.getList() != null && bean.getList().size() > 0) {
                baseViewHolder.setText(R.id.tvPasswordFunctionItemCount, getContext().getString(R.string.record_count, bean.getList().size()));
            } else {
                baseViewHolder.setText(R.id.tvPasswordFunctionItemCount, getContext().getString(R.string.record_count, 0));
            }
        }
    }
}
